﻿using System;

namespace 小说爬取
{
    /// <summary>
    /// 章节数据
    /// </summary>
    public class Chapter
    {
        /// <summary>
        /// 章节序号
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 章节名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 章节地址
        /// </summary>
        public Uri Href { get; set; }

        /// <summary>
        /// 章节内容
        /// </summary>
        public string Text { get; set; }

        /// <summary>
        /// 执行状态
        /// </summary>
        public DownloadState Download { get; set; }

        /// <summary>
        /// 重试次数
        /// </summary>
        public int Retry { get; set; }

        public override string ToString()
        {
            return $"{Id}-{Name}-{Href}-{Retry}";
        }
    }

    /// <summary>
    /// 执行状态
    /// </summary>
    public enum DownloadState
    {
        /// <summary>
        /// 未下载
        /// </summary>
        Before,
        /// <summary>
        /// 正在下载
        /// </summary>
        Underway,
        /// <summary>
        /// 下载成功
        /// </summary>
        Perform,
    }
}